package com.ftg.learn.util;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 *   -- 1. 用户表  列表功能[基础信息展示功能有、分页功能、模糊查询]  list()
 * @author kangjx
 * @date 2024/1/30
 */
public class PageEx<T> {

    public PageEx(Long pageNo, Long pageSize) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
    }

    private Long pageNo;

    private Long pageSize;

    private Long countPage;

    private Long total;

    private List<T> rows;

    public Long getPageNo() {
        return pageNo;
    }

    public void setPageNo(Long pageNo) {
        this.pageNo = pageNo;
    }

    public Long getPageSize() {
        return pageSize;
    }

    public void setPageSize(Long pageSize) {
        this.pageSize = pageSize;
    }

    public Long getCountPage() {
        return this.getTotal() % this.getPageSize() > 0 ? this.getTotal() / this.getPageSize() + 1 : this.getTotal() / this.getPageSize();
    }

    public void setCountPage(Long countPage) {
        this.countPage = countPage;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }
}
